//Name: Behaviors
//Author:Max Charnock
//Last Updated: 20/05/2014
//Purpose: behaviours class which contains the differnt sort of behaviours an enemy can show
//also manages pathfinding for enemies patrols

#pragma once

#include "MathHelper.h"
#include <vector>

//#define MAXIMUM_ACCELERATION 10.0f

class Behaviours
{
private:

	//pointer to bots position
	XMFLOAT3 Position;
	//pointer to bots velocity
	XMFLOAT3 Velocity;

	//maximum bot speed
	float MaxSpeed;

	//max accleration an enemy can reach
	float MaxAcceleration;

	//the current point in the patrol the enemy is at
	int PatrolPoint;

	//the patrol the enmy will follow when pathfinding
	std::vector<XMFLOAT3> Patrol;

	//position of target
	XMFLOAT3 TargetPosition;

	//bools for behaviours
	bool PathFindOn;
	bool SeekOn;
	bool FleeOn;
	bool ArrivalOn;


public:

	Behaviours();

	//sets intial values
	void Initialise(XMFLOAT3 pos, XMFLOAT3 vel);

	//checks behaviours and returns accleration
	XMFLOAT3 AccumulateBehaviours();

	//Acclerates to a certain point
	XMFLOAT3 Seek(XMFLOAT3 Target);

	//Acclerates away from a certain point
	XMFLOAT3 Flee(XMFLOAT3 Target);

	//Acclerates to a certain point then stops
	XMFLOAT3 Arrival(XMFLOAT3 Target);

	//follows path
	XMFLOAT3 PathFind();

	//sets target to closest point in patrol vector
	void SetTargetClosestPatrolPoint();

	//get distance between two points
	float GetDistance(XMFLOAT3 A,XMFLOAT3 B);

	//get gangitude of a float3
	float GetMagnitude(XMFLOAT3 a);

	///////////////////GETS AND SETS //////////////////////
	void SetPath(std::vector<XMFLOAT3> New);

	void SetTargetPosition(XMFLOAT3 New);

	void SetMaxSpeeds(float speed,float accel);

	void SetPathFindOn(bool New);
	void SetSeekOn(bool New);
	void SetFleeOn(bool New);
	void SetArrivalOn(bool New);
	bool GetPathFindOn();
	bool GetSeekOn();
	bool GetFleeOn();
	bool GetArrivalOn();

};